Flash interface for processing dataset

ABSTRACT

Systems and methods for managing content in a flash memory. Content or data in a flash memory is overwritten when the write operation only requires bits to be set. This improves performance of the flash and extends the life of the flash memory.

FIELD OF THE INVENTION

Embodiments of the invention relate to systems and methods for processing large datasets. More particularly, embodiments of the invention relate to systems and methods for interfacing and interacting with a memory device such as a flash memory device.

BACKGROUND

As the amount of data in computing systems continues to increase, there is a strong desire for improvements that allows the datasets to be efficiently processed. DRAM (Dynamic Random Access Memory) and the like are often too small to efficiently process large data sets. Algorithms that process the data out-of-core (using Hard Disk Drives (HDDs) tend to be slow.

One potential solution is to introduce flash memory into the computing systems. Flash memory is faster than HDDs and has the capacity to accelerate dataset analysis. Even though flash memory can improve the processing capability of computing systems, flash memory has several problems that impact performance.

For example, conventional data structures are designed assuming that random changes or random edits can be performed quickly and without penalty. Flash, memory, however, has a penalty associated with small edits. Small edits in a flash memory require the edited page to be copied forward to a new page. The previous page must be eventually erased before it can be reused. More specifically, data in a used area or page of a flash memory cannot be simply overwritten in a conventional flash memory. Rather, it is necessary to erase the page before writing the data. This is the reason that small edits to a page in the flash memory are simply written as a new page.

This process causes both a performance penalty and a lifespan penalty. This process results in multiple reads and writes (thus the performance penalty). The lifespan penalty occurs because flash memory can only be written or erased a limited number of times before wearing out. Further, flash memory is typically erased in large units. Systems and methods are needed to improve the performance of flash memory and to improve the lifespan of the flash memory.

BRIEF DESCRIPTION OF THE DRAWINGS

In order to describe the manner in which at least some aspects of this disclosure can be obtained, a more particular description will be rendered by reference to specific embodiments thereof which are illustrated in the appended drawings. Understanding that these drawings depict only example embodiments of the invention and are not therefore to be considered to be limiting of its scope, embodiments of the invention will be described and explained with additional specificity and detail through the use of the accompanying drawings, in which:

FIG. 1 illustrates an example of a computing system that is configured to perform overwrites in a flash memory;

FIG. 2 illustrates an example of a flash memory that is configured to perform overwrites;

FIG. 3 illustrates an example of internal logic for overwriting portions of a flash memory; and

FIG. 4 illustrates an example of an external interface for overwriting portions of a flash memory and for locking portions of the flash memory when performing overwrites.

DETAILED DESCRIPTION OF SOME EXAMPLE EMBODIMENTS

Embodiments of the invention relate to systems and methods for processing large datasets. Embodiments of the invention further relate to systems and methods for processing large datasets in a flash memory (e.g., SSD (solid state drive)). Embodiments of the invention further relate to systems and methods for controlling or managing flash memory and to interfacing with flash memory.

In a conventional flash memory, the ability to set a bit (i.e., change from a logical 0 to a logical 1) may be supported. However, changing a bit from a logical 1 to a logical 0 (unset the bit) is not supported at this level (e.g., the bit level). Rather, it is necessary to erase a larger unit in the flash memory. By way of example, flash memory may be erased in 1 megabyte units. As a result, it is not generally possible to overwrite existing data in flash. Instead, the data is written to a new location (which may have been previously erased) and the old location is marked for erasure. Embodiments of the invention enable overwrites of existing data in some instances and in various data structures. Embodiments of the invention allow data structures to be implemented in flash while reducing the number of associated erasures by overwriting some of the data.

A flash memory may include a controller and an interface (e.g., API (application programming interface)) associated with the flash memory controller. In one example, the logic of the flash memory controller is configured to perform writes to existing data (overwriting the existing data) rather than write the data to a new location and mark the old location for deletion. If necessary, the controller may cause the data to be simply written to a new location. For an overwrite operation, the controller may initially read the previous version of the page or block being written. If the changes being written only result in the setting of more logical is (or changing 0s to 1s), then the existing page or block can be overwritten. If some bits need to be unset (changed from 1s to 0s) in the flash memory, then the write may be performed normally to a new page. During this process (read-check-overwrite), the page or block may be locked.

In another example, an overwrite can be achieved using calls to a flash memory API. Calls include, by way of example, a logical-OR and a Compare-and-Swap.

During a logical-OR call, a client may provide a block of data and an address. The page (or pages depending on the size of the block of data) at that address is modified to the logical OR of its current contents with the provided block. This only requires setting additional bits. As a result, an overwrite may be performed on the current page or pages without the need to write to a new page or pages. The logical OR changes 0s in the target block that correspond to 1s in the new data to be set. It may not be necessary to perform an OR operation for each bit in the overwrite operation. It may only be necessary to identify the 0s that need to be changed to 1 s.

An overwrite may occur in flash memory by performing a logical OR operation. This operation ensures that 1 s located in a target block are unaffected while 0s are potentially changed to 1 s. The change occurs when the data being overwritten to the target block contains a 1 where the target block contains a 0. A logical OR operation between bits A and B has the possible outcomes:

A B OR Result 0 0 0 0 1 1 1 0 1 1 1 1

A Compare-and-Swap call may be used for locking and thread synchronization when performing overwrites. A client provides the previous version of the block and the new version of the block. More bits are set in the new version. The flash memory, in response to the call, may atomically read the page and compare the read page/block with the previous version provided by the client. If the previous version provided by the client matches the page read from the flash memory, then the page/block is overwritten with the new version provided by the client in the call using, for example, a logical OR. Other compare-and-swap operations to the same page are blocked until the current call completes.

Embodiments of the invention further implement data structures in the flash memory such that the data structure can be updated using overwrites. This prolongs the life of the flash memory by limiting or reducing the number of erasures and can improve the performance of the flash memory. Examples of data structures include, but are not limited to, bloom filters, linked lists, hash tables, locking data structures, trees, graphs, and the like or combinations thereof.

FIG. 1 illustrates an example of a computing system that includes a flash memory and that enables pages to be overwritten from an internal perspective and an external perspective. Overwrites to existing pages (without erasing the data first) can be achieved using internal logic. An external interface, which provides access to an API, allows similar abilities to be invoked by a client. As discussed herein, changing a bit from 0 to 1 is setting a bit and changing a bit from 1 to 0 is unsetting a bit. Unsetting bits can typically only be performed by erasing an erasure unit at a time and an erasure unit may include multiple pages.

FIG. 1 illustrates a computing system 100 that includes processors 102, DRAM 104, flash memory 106, and storage 114. The computing system 100 may be configured to provide computing services such as backup services, document management, contact management, or the like. The computing system 100 can be formed of network connected devices or may be implemented as an integrated unit. The computing system 100 can be connected to a computing network.

The storage 114 may include various hardware storage devices (e.g., magnetic, optical, etc.) such as HDDs. The storage 114 can be arranged in different manners. The DRAM 104 and the flash 106 can be used as caches in the computing system 100. The DRAM, which is the fastest memory, is typically smaller than the flash memory 106. The flash memory 106 is typically smaller than the storage 114. In other embodiments, the flash 106 may be the primary storage and the storage 114 could be omitted. The flash memory 106 can be large (e.g., terabytes or larger). The computing system 100 may be configured for processing large data sets such as backup data, data lake data, or the like.

The flash memory 106 is associated with a flash controller 108 and a flash API 110. The flash controller 108 typically controls operations occurring within the flash 106 and may include its own processor and memory. The flash API 110 allows clients to make specific calls to the flash memory 106, which may be executed by the flash controller 108. The client may be any device or component (e.g., processor, memory controller, process) that interacts with the flash memory 106.

The flash controller 108 is associated with logic 112 that may be configured to interact with the data stored in the flash memory 106. The logic 112, for example, may perform overwrites, logical-ORs, compare-and-swaps, or the like.

FIG. 2 illustrates an example of a flash memory and illustrates how data may be arranged in the flash memory. FIG. 2 illustrates a flash memory 200, which is an example of the flash memory 106 shown in FIG. 1. The flash memory 200 includes erasure units, such as erasure units 202 and 212. Each erasure unit is associated with pages. Pages 204, 206, 208, and 210 are associated with the erasure unit 202 and the pages 214, 216, 218, and 220 are associated with the erasure unit 212. One of skill in the art can appreciate that the flash memory is typically much larger than illustrated.

The pages 204, 206, 208, and 210 are smaller than the erasure unit 202. By way of example only, the pages 204, 206, 208, and 210 may be 4 KB each. The erasure units 202 and 212 may be 1 MB each. Data stored in the flash memory 200 may also be arranged in containers or using other storage arrangements. However, when data is written to the flash memory 200, the data is written in pages and the pages are usually written in sequence.

In order to overwrite a page in a conventional flash, it is necessary to erase all pages in the erasure unit before writing the pages in the newly erased erasure unit or write the new page to a new location. For example, the page 208 includes data. Because the page 208 contains data, a conventional flash cannot simply write new data to the page 208. Rather, it is necessary to erase all pages 204, 206, 208, and 210 in the erasure unit 202 before new data can be written to the page 208. In fact, all pages in the erasure unit 202 would be erased. The new data could alternatively be written to a new location and the existing page or erasure unit marked for erasure.

Embodiments of the invention, in contrast, allow data to be written to the page 208 by performing an overwrite operation. In particular, embodiments of the invention allow data to be written to the page 208 or any other page in the erasure unit 202 as long as the write makes no changes so specific cells (or bits) become unset, but only changes 0 bits to 1s. This is because the flash memory 200 may allow more electrons to be stored in an individual cell (representing one bit) thus semantically changing the value from 0 to 1. Reducing the electrons to change a 1 to a 0, however, involves erasing an entire erasure unit due to the hardware constraints. Thus, data such as 0000 can be overwritten as 0101 because only 0s are being changed to 1 s. An overwrite is not permitted when attempting to change 1110 to 0010 because this involves changing 1s to 0s for this type of flash memory. In this case when changing 1s to 0s, it may be necessary to follow conventional flash memory writing procedures, which may involve writing the data to a new page and erasing the pages in the erasure unit.

FIG. 3 illustrates an example of a flash memory that includes a controller and illustrates an example of logic associated with performing an overwrite in the flash memory. FIG. 3 illustrates that the flash memory 300 may receive a write block 302 from a client (e.g., a thread, process, or the like). When the write block 302 is received, the controller may perform controller logic 304 to perform the write operation in the flash memory 300.

The write operation may include performing a method 310. The write block 302 may write to more than one page in the flash memory 300. In box 312, the controller 320 may read the target block 306. The target block 306 may be, by way of example, a previous version of the write block 302. The target block 306 may be located at a destination address included in the write request received along with the write block 302.

After reading the target block 306, the controller 320 may compare the target block 306 with the write block 302. The result of the comparison determines, in one example, whether the target block 306 can be overwritten with the write block 302 or whether the write block is written to a new location as the new block 308. The comparison may identify which bits need to be changed from 0s to 1s.

In one example, if the comparison in box 314 determines that writing the write block 302 to the target block 306 would only set bits from 0 to 1, then the target block 306 is overwritten with the write block 302 in box 316. If the comparison determines that it is necessary to reset 1s to 0s, then the write block 302 is written to a new location as the new block 308 in box 318. The target block 306 may be marked for deletion or erasure.

The logic performed in the method 310 is internal to the flash memory 300 in this example. The client associated with the write operation may not be aware of the overwrite method performed in the flash memory 300.

During the method 310 and in particular while reading the target block, comparing the target block with the write block and overwriting the target block, the page or pages associated with the target block are locked at 320 so that another client does not interfere with the method 310. A lock may be used during the overwrite method 310. The controller 320 may set aside some memory to track which regions of the flash memory 300 are locked.

FIG. 4 illustrates an example of an external interface for overwrites in a flash memory. FIG. 4 illustrates a flash memory 400, which is an example of the flash memory 106 in FIG. 1. The flash memory 400 includes a controller 406 and an API 408. The API 408 includes calls 410 including, by way of example, a logical-OR 412 and a Compare and Swap 414.

In contrast to the internal logic illustrated in FIG. 3, the API allows a client to explicitly call the API 408. The logical-OR call 412 allows a client 402 to provide a block of data and an address 404. A logical OR is performed between the page or pages at the address provided in the client request 402 with the block 416 at the specified address. This call compares or performs a logical OR with each respective bit. A logical OR has the property that it never changes a one to a zero, but zeros may be changed to one if they are ORed with a one. This operation is an overwrite that potentially replaces 0s in the block 416 to 1s. The client may be aware, prior to making the call, that the necessary updates to the block 416 can be achieved with the logical OR operation. Depending on hardware capabilities, a logical OR operation may not be required for each bit. Rather, the logical OR effectively changes 0s in to the block 416 to 1s based on the contents of the block provided in the client request 402. Thus, the logical OR may simply identify the bits to be changed to 1s and make those changes. If the hardware is configured such that an entire page is written at a time, then the page is written such that the relevant 0s are changed to 1s.

The compare and swap call 414 can be used for locking and for thread synchronization when performing overwrites. When making a compare and swap call 414, the client may provide a previous version of a block and a new version of the block. The new version may have new bits set. The controller 406 may then compare the previous version included in the request with the block 416 to insure that another client has not changed the block. If the comparison is equal, the block 416 can be overwritten (e.g., by using logical-OR operation) with the new version included in the client request 402. Other callers attempting to impact or alter block 416 will be blocked until these compare and swap operation completes. Thus, the controller 406 may also lock locations in the flash memory 400 that are being updated or changed in accordance with the controller logic or API calls 410.

The calls and logic discussed herein may be implemented with computer executable instructions and the controller 406 and/or the flash memory 400 are examples of a computing device. The calls and logic discussed herein may also be used when interacting (e.g., read/write/update) with data structures implemented in a flash memory.

The embodiments disclosed herein may include the use of a special purpose or general-purpose computer including various computer hardware or software modules, as discussed in greater detail below. A computer may include a processor and computer storage media carrying instructions that, when executed by the processor and/or caused to be executed by the processor, perform any one or more of the methods disclosed herein.

As indicated above, embodiments within the scope of the present invention also include computer storage media, which are physical media for carrying or having computer-executable instructions or data structures stored thereon. Such computer storage media can be any available physical media that can be accessed by a general purpose or special purpose computer.

By way of example, and not limitation, such computer storage media can comprise hardware such as solid state disk (SSD), RAM, ROM, EEPROM, CD-ROM, flash memory, DRAM, phase-change memory (“PCM”), or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other hardware storage devices which can be used to store program code in the form of computer-executable instructions or data structures, which can be accessed and executed by a general-purpose or special-purpose computer system to implement the disclosed functionality of the invention. Combinations of the above should also be included within the scope of computer storage media. Such media are also examples of non-transitory storage media, and non-transitory storage media also embraces cloud-based storage systems and structures, although the scope of the invention is not limited to these examples of non-transitory storage media.

Computer-executable instructions comprise, for example, instructions and data which cause a general purpose computer, special purpose computer, or special purpose processing device to perform a certain function or group of functions. Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts disclosed herein are disclosed as example forms of implementing the claims.

As used herein, the term ‘module’ or ‘component’ can refer to software objects or routines that execute on the computing system. The different components, modules, engines, and services described herein may be implemented as objects or processes that execute on the computing system, for example, as separate threads. While the system and methods described herein can be implemented in software, implementations in hardware or a combination of software and hardware are also possible and contemplated. In the present disclosure, a ‘computing entity’ may be any computing system as previously defined herein, or any module or combination of modules running on a computing system.

In at least some instances, a hardware processor is provided that is operable to carry out executable instructions for performing a method or process, such as the methods and processes disclosed herein. The hardware processor may or may not comprise an element of other hardware, such as the computing devices and systems disclosed herein. A controller may include a processor and memory and/or other computing chips.

In terms of computing environments, embodiments of the invention can be performed in client-server environments, whether network or local environments, or in any other suitable environment. Suitable operating environments for at least some embodiments of the invention include cloud computing environments where one or more of a client, server, or target virtual machine may reside and operate in a cloud environment.

The present invention may be embodied in other specific forms without departing from its spirit or essential characteristics. The described embodiments are to be considered in all respects only as illustrative and not restrictive. The scope of the invention is, therefore, indicated by the appended claims rather than by the foregoing description. All changes which come within the meaning and range of equivalency of the claims are to be embraced within their scope. 

What is claimed is:
 1. A device comprising: a flash memory; and a controller that includes a processor, wherein the controller is configured to write to the flash memory and to read from the flash memory; wherein the controller is configured to perform an overwrite operation is the flash memory by performing controller logic without input from a client; wherein the controller is configured to provide an interface to the client that allows the client to specify how to perform the overwrite operation in the flash memory.
 2. A device comprising: a flash memory; and a controller that includes a processor, wherein the controller is configured to write to the flash memory and to read from the flash memory; wherein the controller is configured to perform an overwrite operation is the flash memory by performing controller logic without input from a client; wherein the controller is configured to provide an interface to the client that allows the client to specify how to perform the overwrite operation in the flash memory; wherein the controller is configured to lock a location in the flash memory associated with an overwrite operation in the flash memory using a locking structure.
 3. The device of claim 2, wherein the controller is configured to overwrite the locking structure with the controller logic when locking the location.
 4. The device of claim 2, wherein the controller is configured to lock the location by performing a compare and swap operation after determining that data at the location has not changed been changed by comparing the data with a previous version of the data.
 5. The device of claim 4, wherein the controller is configured to receive the previous version of the data and a new version of the data for the overwrite operation from the client.
 6. The device of claim 1, wherein the controller is configured to perform a write operation to a table in memory when the overwrite operation cannot be performed.
 7. The device of claim 1, wherein the controller includes an external interface, wherein the controller is configured to receive a call from the client at the external interface.
 8. The device of claim 7, wherein the external interface comprises an application programming interface.
 9. The device of claim 7, wherein the call includes a data block and an address and wherein the call identifies a specific overwrite operation, the specific overwrite operation including at least one of a compare and swap operation or a logical OR operation.
 10. The device of claim 9, wherein the controller is configured to read the target block, compare a write block with the target block, and overwrite the target block with the write block.
 11. The device of claim 1, wherein the overwrite operation is performed only when sets are needed to overwrite a target block with a write block.
 12. The device of claim 2, wherein the controller is configured to receive a call from the client via the interface, wherein the call includes a data block and an address, and wherein the call specifies how to perform the overwrite operation.
 13. The device of claim 12, wherein the controller is configured to overwrite a target block with the data block.
 14. The device of claim 13, wherein the controller is configured to read the target block, compare the target block with the data block and overwrite the target block based on the comparison, wherein the comparison identifies bits to set.
 15. The device of claim 12, further comprising writing the data block to a table in a memory or to a new location in the flash memory when the overwrite operation cannot be performed.
 16. A method for managing a flash memory, the method comprising: performing operations on the data blocks in the flash memory by: performing an overwrite operation in the flash memory by overwriting a target block with a write block in accordance with input from a client, wherein the input specifies how to perform the overwrite operation on the target block in the flash memory; performing the overwrite operation in the flash memory on the target block by a controller when the input is not received from the client, wherein the controller determines how to perform the overwrite operation on the target block in the flash memory; and performing a write operation to write the write block to a new location in the flash memory or to a table in a memory separate from the flash memory when the overwrite operation in the flash memory cannot be performed.
 17. The method of claim 16, further comprising receiving a call from the client at an external interface, wherein the call identifies the overwrite operation and includes the write block and an address of the target block.
 18. The method of claim 16, further comprising locking the target block such that other threads cannot access the target block until the overwrite operation is completed.
 19. The method of claim 16, further comprising locking the target block using a locking structure stored in the flash memory, locking the target block includes performing an overwrite operation on the locking structure stored in the flash memory.
 20. The method of claim 16, wherein the overwrite operation is one of a compare and swap operation or a logical OR operation, wherein the overwrite operation includes only setting bits in the target block. 